VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{736A8444-E374-41A8-B526-1B07FD2F3F5B}#1.0#0"; "BLacKPeaRLOCX.ocx"
Begin VB.Form FrmPenjView 
   BackColor       =   &H00000000&
   BorderStyle     =   0  'None
   ClientHeight    =   4320
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6360
   LinkTopic       =   "Form1"
   ScaleHeight     =   4320
   ScaleWidth      =   6360
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin BLacKPeaRLOCX.BLacKFrame framepenj 
      Height          =   4335
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   6375
      _ExtentX        =   11245
      _ExtentY        =   7646
      BackColor1      =   0
      BackColor2      =   4210752
      Caption         =   "List Penjualan"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   49152
      TitleColor1     =   0
      TitleColor2     =   4210752
      TitleGradient   =   2
      TitleHeight     =   350
      BorderColor     =   49152
      BorderWidth     =   2
      Begin VB.ComboBox txtnota 
         BackColor       =   &H00000000&
         ForeColor       =   &H0000C000&
         Height          =   315
         Left            =   720
         Sorted          =   -1  'True
         TabIndex        =   7
         ToolTipText     =   "Tekan enter untuk lanjut"
         Top             =   3840
         Visible         =   0   'False
         Width           =   1695
      End
      Begin VB.TextBox txtnoclient 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   250
         Left            =   990
         Locked          =   -1  'True
         TabIndex        =   4
         Top             =   525
         Width           =   1815
      End
      Begin BLacKPeaRLOCX.ButtonNix CmdBatal 
         Height          =   375
         Left            =   4920
         TabIndex        =   0
         Top             =   3840
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Tutup"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   16777215
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmPenjView.frx":0000
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin ComctlLib.ListView lvbar 
         Height          =   2655
         Left            =   240
         TabIndex        =   3
         Top             =   1080
         Width           =   5895
         _ExtentX        =   10398
         _ExtentY        =   4683
         View            =   3
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         _Version        =   327682
         ForeColor       =   49152
         BackColor       =   0
         BorderStyle     =   1
         Appearance      =   1
         NumItems        =   6
         BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "No"
            Object.Width           =   265
         EndProperty
         BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   1
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Nama Barang"
            Object.Width           =   3175
         EndProperty
         BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   2
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Harga"
            Object.Width           =   1764
         EndProperty
         BeginProperty ColumnHeader(4) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   3
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Qty"
            Object.Width           =   529
         EndProperty
         BeginProperty ColumnHeader(5) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   4
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Total"
            Object.Width           =   1940
         EndProperty
         BeginProperty ColumnHeader(6) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
            SubItemIndex    =   5
            Key             =   ""
            Object.Tag             =   ""
            Text            =   "Hargabel"
            Object.Width           =   0
         EndProperty
      End
      Begin VB.TextBox txtws 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   250
         Left            =   4110
         Locked          =   -1  'True
         TabIndex        =   2
         Top             =   525
         Width           =   615
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "Nota"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   240
         TabIndex        =   8
         Top             =   3840
         Visible         =   0   'False
         Width           =   615
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "Client"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   480
         Width           =   735
      End
      Begin VB.Shape Shape2 
         BackColor       =   &H00004040&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00C0FFC0&
         Height          =   345
         Left            =   960
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   1890
      End
      Begin VB.Shape Shape3 
         BackColor       =   &H00004040&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00C0FFC0&
         Height          =   345
         Left            =   4080
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   690
      End
      Begin VB.Label Label7 
         BackStyle       =   0  'Transparent
         Caption         =   "WStation"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   255
         Left            =   3120
         TabIndex        =   5
         Top             =   480
         Width           =   735
      End
   End
End
Attribute VB_Name = "FrmPenjView"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdBatal_Click()
Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo hell
rec.Open "select penjualan.* from penjualan where penjualan.nota='" & FrmMain.MSFlexGrid.TextMatrix(FrmMain.MSFlexGrid.Row, 9) & "' and penjualan.ID='" & FrmMain.MSFlexGrid.TextMatrix(FrmMain.MSFlexGrid.Row, 2) & "' and penjualan.jenis='" & "Jasa" & "' and penjualan.stat='" & "Pending" & "' and penjualan.cls='" & "No" & "'", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
rec.Close

Else
txtnota.Text = rec(0)
rec.Close
loadpenj
End If
IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "formload", Me.Name
 Resume IfNoErr

End Sub

Private Sub loadpenj()
On Error GoTo hell
rec.Open "select penjualan.* from penjualan where penjualan.Nota= '" & txtnota.Text & "' and penjualan.jenis='" & "Jasa" & "' and penjualan.stat='" & "Pending" & "' and penjualan.cls='" & "No" & "'group by namabarang ", conn, adOpenStatic, adLockOptimistic
With rec
While Not .EOF
Set lstItem = lvbar.ListItems.Add(, , lvbar.ListItems.Count + 1 & ".")
lstItem.SubItems(1) = rec(3)
lstItem.SubItems(2) = rec(5)
lstItem.SubItems(3) = rec(6)
lstItem.SubItems(4) = rec(7)
.MoveNext
Wend
End With
rec.Close
IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "loadpenj", Me.Name
 Resume IfNoErr

End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error GoTo hell
If lvbar.ListItems.Count = 0 Then
rec.Open "select aktifitas.* from aktifitas where aktifitas.no_client='" & txtws.Text & "'", conn, adOpenStatic, adLockOptimistic
If rec.RecordCount = 0 Then
rec.Close
Else
rec(5) = "No"
rec.Update
rec.Close
End If
FrmMain.MSFlexGrid.TextMatrix(FrmMain.MSFlexGrid.Row, 9) = "No"
End If
IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "formunload", Me.Name
 Resume IfNoErr

End Sub

Private Sub lvbar_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error GoTo hell
    If Button = 2 Then
    Dim Pt As POINTAPI
    Dim ret As Long
    RMenu = CreatePopupMenu()
    AppendMenu RMenu, MF_STRING, 1, "Hapus"
    GetCursorPos Pt
    ret = TrackPopupMenuEx(RMenu, TPM_LEFTALIGN Or TPM_RETURNCMD Or TPM_RIGHTBUTTON, Pt.X, Pt.Y, Me.hWnd, ByVal 0&)
   Select Case ret
   Case 1
   If lvbar.ListItems.Count = 0 Then
   MsgBox "Tidak ada penjualan pada Client ini.", vbInformation, "Blank"
   Exit Sub
   Else
   If MsgBox("Masukkan data ke stock barang, pilihan ini akan menambahkan barang yang telah di beli oleh client.", vbYesNo) = vbYes Then
   
   rec.Open "select Penjualan.* From Penjualan where penjualan.Nota='" & txtnota.Text & "' and penjualan.namabarang='" & lvbar.SelectedItem.SubItems(1) & "'", conn, adOpenStatic, adLockOptimistic
   rec.Delete
   rec.Close
   
   rec.Open "select databarang.* from databarang where databarang.namabarang ='" & lvbar.SelectedItem.SubItems(1) & "'", conn, adOpenStatic, adLockOptimistic
   rec(3) = Val(rec(3)) + Val(lvbar.SelectedItem.SubItems(3))
   rec.Update
   rec.Close
   Else
      rec.Open "select Penjualan.* From Penjualan where penjualan.Nota='" & txtnota.Text & "' and penjualan.namabarang='" & lvbar.SelectedItem.SubItems(1) & "'", conn, adOpenStatic, adLockOptimistic
   rec.Delete
   rec.Close
End If
   lvbar.ListItems.Clear
   loadpenj
   End If
   End Select
   
End If

IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "lvbar_mouseup", Me.Name
 Resume IfNoErr


End Sub
